/**
 * @文件路径         : \my-electron-app\main.js
 * @创建日期         : 2024-08-23 14:43:07
 * @简要说明         : 
 * @
 * @LastEditTime : 2024-08-26 18:13:56
 */

const { app, BrowserWindow, Notification } = require('electron')



const NOTIFICATION_TITLE = '刘总牛逼'
const NOTIFICATION_BODY = '66666666666666'
function showNotification () {
    setInterval(()=>{
        new Notification({
            title: NOTIFICATION_TITLE,
            body: NOTIFICATION_BODY
        }).show()
    }, 1000)
}


const createWindow = () => {
    const win = new BrowserWindow({
      // fullscreen: true,
      width: 1200,
      height: 1200,
      webPreferences: {
        nodeIntegration: true,
        contextIsolation: false,
        devTools: true // 确保开发者工具可用
      }
    })
  
    win.loadFile('index.html')
  }

  app.whenReady().then(() => {
    createWindow()
  }).then(showNotification)


  app.on('window-all-closed', () => {
    if (process.platform !== 'darwin') {
      app.quit()
    }
  })
  
  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) {
      createWindow()
    }
  })